// 专用用于处理user相关的路由
import { Router } from 'express';
import bodyParser from 'body-parser';
//中间件
import { checkAuth, checkBody } from '../middlewares/user';
//控制器方法集合
import {
  getProfile,
  register,
  login,
  getUserList,
  checkLogin
} from '../controllers/User';

const router = Router();
const jsonParser = bodyParser.json();

router.get('/api/user/get_user_list', getUserList);
router.post('/api/user/register', jsonParser, checkBody, register);
router.post('/api/user/login', jsonParser, checkBody, login);
router.post('/api/user/profile', jsonParser, checkAuth, getProfile);
router.post('/api/user/check_login', jsonParser, checkAuth, checkLogin);

export default router;
